---
sidebar_position: 12
---

# Add Shield

Shield typically rely on using an existing [board definition](/developer/board-configuration)
and with extra configuration using `configureHardware`
and the logic to start drivers.

-   [ ] create a class `Shield` (rename to your shield name) and add the `@devsPart`, `@devsWhenUsed` attribute in the jsdoc.

```ts skip
/**
 * A shield driver
 * @devsPart My Shield name
 * @devsWhenUsed
 */
export class Shield {}
```

-   [ ] call `configureHardware` in the constructor to setup additional hardware configuration like I2C.

```ts skip
export class Shield {
    constructor() {
        // highlight-next-line
        configureHardware({
            ...
        })
    }
}
```

-   [ ] add instance methods to start each driver

```ts skip
export class Shield {
    startButton() {
        return startButton({
            pin: pins.GP10,
            activeHigh: true,
        })
    }
}
```

## Add to this repository

-   [ ] fork the `microsoft/devicescript` repository
-   [ ] add driver in `packages/drivers` (see others), export from `packages/drivers/index.ts`
-   [ ] add documentation page under `website/docs/devices/shields`, see others
-   [ ] add entry in `website/docs/devices/index.tsx`

## How-to publish on npm

-   [ ] start a new DeviceScript project
-   [ ] run the **DeviceScript: add npm...** command to prepare it for publishing
-   [ ] add the board package for your target [device](/devices)

-   [ ] update the README with examples and documentation
-   [ ] publish a release of your package
-   [ ] send us a pull request so we list your shield package!
